package com.api.core.response;

public enum ResultEnum implements IResultEnum {
    SUCCESS_MESSAGE("request success",200),//服务器成功返回用户请求的数据
    LOGIN_SUCCESS("login success",200),//服务器成功返回用户请求的数据
    LOGIN_OUT_SUCCESS("logout success",200),//服务器成功返回用户请求的数据
    CREATED("create success",200),//用户新建或修改数据成功
    UPLOADED("upload success",200),
    MODIFIED("update success",200),//用户新建或修改数据成功
    DELETED("delete success",200),//用户删除数据成功
    FAIL("request fail",400),//用户发出的请求有错误，服务器没有进行新建或修改数据的操作
    INTERNAL_SERVER_ERROR("The server is busy. Please try again later",500),//服务器内部错误
    NO_CONTENT("No relevant data found",20010),
    NO_UNDELIVERED_MESSAGE("所有信息已经传递完毕",20011),
    UNAUTHORIZED("User does not have permission",401),
    LOGIN_FAIL("Wrong user name or password",401),
    FORBIDDEN("Users are not allowed to access this content",403),//表示用户得到授权（与401错误相对），但是访问是被禁止的
    REGISTER_FAIL("注册失败，请检查用户名与密码等信息是否符合规则,或者是账户名已被注册",400101),
    CREATE_FAIL("新建数据失败",400103),
    DELETE_FAIL("无法删除数据，因为数据在其它表中仍被使用，请先删除子表中数据",400104),
    NO_IMAGE_PARAM("参数中无图片输入",400105),
    IMG_UPLOAD_FAIL("上传图片失败,请再次上传图片",400106),
    UPDATE_FAIL("更新信息失败",400107),
    DATE_ENTRY_ERROR("Error in input data",400110),
    NULL("数据不能为空",400111),
    UPLOADED_FAIL("Failed to upload file",400112),
    UPLOADED_MAX("The file is too large to upload",400113),
    CONNECT_EXCEPTION("Network link exception",400114),
    REDIS_CONNECTION_FAILUR("Redis connection failed",400115),
    PARAMS_LACK("Missing parameter",400116),
    MODULE_EXISTS("Module does not exist",400117),
    DUPLICATE_KEY("Violation of unique constraint",400118),
    PASSWORD_ERROR("密码错误",400119),
    ADDRESSNULL("请填写默认配送地址，方便医生开药后快速送达",4002),
    PAYFAILD("订单创建失败",433)
    ;

    private final String message;
    private final int code;

    ResultEnum(String message, int code) {
        this.message = message;
        this.code=code;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
